import Cocoa
//https://blog.csdn.net/zhanglei5415/article/details/130891609


///协议：Shape
protocol Shape {}

/// Rectangle
struct Rectangle: Shape {}
/// Union
struct Union<A: Shape, B: Shape>: Shape {
    var a: Shape
    var b: Shape
}

/// Transformed
struct Transformed<S: Shape>: Shape {
    var shape: S
}

///协议：GameObject
protocol GameObject {
    associatedtype ShapeType: Shape
    var shape: ShapeType { get }
}
/// EightPointedStar
struct EightPointedStar: GameObject {
    var shape: Union<Rectangle, Transformed<Rectangle>> {
        return Union(a:Rectangle(), b:Transformed(shape: Rectangle()))
    }
}

let eight = EightPointedStar()
